package pnr

import (
	"lib/analysis-pnr/amadeus"
	"lib/analysis-pnr/travelskypnr"
	"shopping/model"
)

func GetFlightDetailByPnr(pnr string) (flightDetail *model.PnrDetail) {
	switch pnr[:3] {
	case "---":
		order := amadeus.NewPNR(pnr)
		order.Analysis()
		analysis := order.Ouput()
		flightDetail = amadeus.HandleFlightDetail(analysis)
		break
	default:
		handlePnr := travelskypnr.NewAnalysis(pnr)
		analysis := handlePnr.Output()
		flightDetail = travelskypnr.HandleFlightDetail(analysis)
	}
	return

}
